package com.hummingbird.portal.mapper;

import com.hummingbird.portal.pojo.Question;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* <p>
    *  Mapper 接口
    * </p>
*
* @author -1E18
* @since 2024-09-22
*/
@Repository
public interface QuestionMapper extends BaseMapper<Question> {
    @Select("select q.* from question q left join user_question uq on q.id = uq.question_id" +
            " where q.user_id = #{userId} or uq.user_id = #{userId} order by q.createtime desc")
    List<Question> findTeacherQuestions(Integer userId);
}
